package db

import (
	"context"
	"errors"

	v1 "dubbo-go-app/pkg/internal/data/v1"
	"dubbo-go-app/pkg/internal/domain/do"

	"gorm.io/gorm"
)

type activitys struct {
	db *gorm.DB
}

func newActivitys(factory *mysqlFactory) *activitys {
	return &activitys{db: factory.db}
}
func (u *activitys) Delete(ctx context.Context, activityId int64) (*do.ActivityRspDO, error) {
	if db := u.db.Where("activity_id=?", activityId).Delete(&do.ActivityDO{}); db.Error != nil {
		return nil, errors.New("not found activity")
	}
	return &do.ActivityRspDO{"ok"}, nil
}

var _ v1.ActivityStore = &activitys{}
